﻿/*----------------------------------------------------------------------------------------
*
*  Copyright 2019, Gao Hai Hui, <fromzeropoint@126.com>.  All rights reserved.
*  https://gitee.com/helloworldghh/xoskit.git
*  Use of this source code is governed by a MIT license
*  that can be found in the License file.
*
----------------------------------------------------------------------------------------*/
#ifndef __IMPL_MGR_H__
#define __IMPL_MGR_H__

namespace xos_http
{

    class mgr : public i_http_mgr
    {
    public:
        typedef xos::release_impl< mgr > T;

    public:
        mgr();
        ~mgr();

    public:
        static int static_init( xos_container::i_container * pContainer, i_http_mgr ** ppv );
        static xos_container::i_container * container();
        static xos_common::i_common * common();
        static xos_common::i_misc * common_misc();
        static xos_box::i_serial * serial();
        static xos_common::i_md5 * md5();
        static xos_log::i_log * log();
        static xos_box::i_big_buf * big_buf();
        static xos_box::i_buf * buf();
        static xos::i_misc * misc();
        static xos::i_crt * crt();
        static xos::i_xos * xos();
        static mgr * get();
        static int valid_value( const char * lpszStr );
        static int valid_key( const char * lpszStr );
        static int valid_uri( const char * lpszStr );

    public:
        int fmt_simple_html( char * lpszOut, int nSize, int * pnSize, const char * lpszTitle, const char * lpszInfo );
        int get_gz_file_if_awailable( char * lpszDstFullFile, int nDstLen, const char * lpszSrcFullFile );

        int init_compress_type( xos_box::i_list * pTypeList );
        const char * compress_type( const char * lpszType );

        int init_content_type( xos_box::i_list * pTypeList );
        const char * content_type( const char * lpszFile );

        f_session session_callback( f_session * ppFun );
        f_cookie cookie_callback( f_cookie * ppFun );

        int create( enumObj obj, void ** ppv );
        int heart( int interval_ms );

    public:
        int put_back_to_pool( T * pT, bool bLock );
        int init();
        int term();

    };

} // xos_http

#endif // __IMPL_MGR_H__
